package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(90)"`
	Password string `gorm:"type:varchar(32)"`
	Follow   []Follow
}

type Video struct {
	gorm.Model
	Title       string `gorm:"type:varchar(50)"`
	Content     string `gorm:"type:text"`
	Img         string `gorm:"varchar(255)"`
	LikeCount   int    `gorm:"type:int"`
	FollowCount int    `gorm:"type:int"`
	UserId      int    `gorm:"type:int"`
	User        User   `gorm:"foreignerKey:UserId"`
}

type Like struct {
	gorm.Model
	UserId  int   `gorm:"type:int"`
	User    User  `gorm:"foreignerKey:UserId"`
	VideoId int   `gorm:"type:int"`
	Video   Video `gorm:"foreignerKey:VideoId"`
}

type Follow struct {
	gorm.Model
	UserId  int   `gorm:"type:int"`
	User    User  `gorm:"foreignerKey:UserId"`
	VideoId int   `gorm:"type:int"`
	Video   Video `gorm:"foreignerKey:VideoId"`
}
